package de.koller.worlders.engine.entity.mo;

import de.koller.oceanFramework.tree.Child;
import de.koller.worlders.WSea;
import de.koller.worlders.gameplay.BuildableTiles;
import de.koller.worlders.gameplay.PointRate;
import de.koller.worlders.gameplay.Progress;

public class PlayerPoints extends WSea {
	
	@Child private final BuildableTiles buildableTiles = new BuildableTiles();
	@Child private final Progress progress = new Progress();
	private long tryTime = 0;
	private int points = 0;
	
	public void add( PointRate points ) {
		this.points += points.getValue();
		progress.pointProgress();
	}

	public void reset() {
		this.points = 0;

		this.tryTime = wroot != null ? wroot.getTime() : 0;
	}
	
	public int getPoints() {
		return points;
	}

	public int getTryTime() {
		return (int)((wroot.getTime() - tryTime) / 1000);
	}

	public BuildableTiles getBuildableTiles() {
		return buildableTiles;
	}

	public Progress getProgress() {
		return progress;
	}
	
}
